package top.zackyoung.springboot.service.impl

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
import com.github.yulichang.base.MPJBaseServiceImpl
import org.springframework.stereotype.Service
import top.zackyoung.springboot.entity.ScalaUser
import top.zackyoung.springboot.jpa.ScalaUserDao
import top.zackyoung.springboot.mapper.ScalaUserMapper
import top.zackyoung.springboot.service.ScalaUserService

import java.util.Optional
import javax.annotation.Resource

@Service
class ScalaUserServiceImpl extends MPJBaseServiceImpl[ScalaUserMapper, ScalaUser] with ScalaUserService {
  @Resource
  var scalaUserDao: ScalaUserDao = _
  @Resource
  var scalaUserMapper:ScalaUserMapper=_

  override def getById(id: Long): Optional[ScalaUser] = {
    scalaUserDao.findById(id)
  }

  override def getByIdMP(id: Long): Optional[ScalaUser] = {
    Optional.ofNullable(scalaUserMapper.selectById(id))
  }
}
